﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace JustPlus
{
    /// <summary>
    /// SettingPanel.xaml 的交互逻辑
    /// </summary>
    public partial class SettingPanel : UserControl
    {
        //private 
        public SettingPanel()
        {
            InitializeComponent();
            defCheckBox1.isChecked = Properties.Settings.Default.UpdateWhenStart;
            defCheckBox2.isChecked = Properties.Settings.Default.RememberChannel;
            defCheckBox3.isChecked = Properties.Settings.Default.AutoChangeBKGround;
            defCheckBox4.isChecked = Properties.Settings.Default.MiniShowInTask;
            defCheckBox5.isChecked = Properties.Settings.Default.OpenAero;
            slider1.Value = Properties.Settings.Default.DefaultVolume * 10;
        }

        private void Grid_MouseLeave(object sender, MouseEventArgs e)
        {
            MainWindow mwnd = (MainWindow)Application.Current.MainWindow;
            mwnd.stackPanel1.Children.Clear();
            mwnd.stackPanel1.Children.Add(mwnd.stackPanel2);
            mwnd.stackPanel1.Children.Add(mwnd.stackPanel3);
        }

        private void defCheckBox1_MouseEnter(object sender, MouseEventArgs e)
        {
            textBlock1.Text = @"软件启动时开启自动更新选项，建议关闭！这样可以加快软件启动速度和歌曲加载速度！如需要最新版本，请手动选择主界面上的更新按钮！";
        }

        private void defCheckBox2_MouseEnter(object sender, MouseEventArgs e)
        {
            textBlock1.Text = @"软件关闭时记住播放的频道选项，建议开启！这样方便为您选择您喜欢的音乐与频道！";
        }

        private void defCheckBox3_MouseEnter(object sender, MouseEventArgs e)
        {
            textBlock1.Text = @"自动更换背景选项，每首歌加载完毕后更换软件背景，建议开启！";
        }

        private void defCheckBox4_MouseEnter(object sender, MouseEventArgs e)
        {
            textBlock1.Text = @"切换到Mini模式，是否在任务栏显示，依据个人习惯！显示在任务栏可以进行快捷操作，当然在托盘也可以！";
        }

        private void defCheckBox5_MouseEnter(object sender, MouseEventArgs e)
        {
            textBlock1.Text = @"开启全透明模式，若开启，自动换背景将自动失效！";
        }

        private void defCheckBox1_MouseLeave(object sender, MouseEventArgs e)
        {
            textBlock1.Text = "";
        }

        private void defCheckBox2_MouseLeave(object sender, MouseEventArgs e)
        {
            textBlock1.Text = "";
        }

        private void defCheckBox3_MouseLeave(object sender, MouseEventArgs e)
        {
            textBlock1.Text = "";
        }

        private void defCheckBox4_MouseLeave(object sender, MouseEventArgs e)
        {
            textBlock1.Text = "";
        }

        private void defCheckBox5_MouseLeave(object sender, MouseEventArgs e)
        {
            textBlock1.Text = "";
        }
        private void button2_Click(object sender, RoutedEventArgs e)
        {
            Properties.Settings.Default.UpdateWhenStart = defCheckBox1.isChecked;
            Properties.Settings.Default.RememberChannel = defCheckBox2.isChecked; 
            Properties.Settings.Default.MiniShowInTask = defCheckBox4.isChecked;
            if (defCheckBox5.isChecked)
                defCheckBox3.isChecked = false;
            Properties.Settings.Default.AutoChangeBKGround = defCheckBox3.isChecked;
            Properties.Settings.Default.OpenAero = defCheckBox5.isChecked;
            Properties.Settings.Default.DefaultVolume = slider1.Value / 10;
            Properties.Settings.Default.Save();
            textBlock1.Text = "设置已保存，部分设置在软件重启后生效！";
        }
    }
}
